﻿package mortal.game.view.copy.sunbathCopy.render
{
    import Message.Public.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class SunbathDanceCell extends GCellRenderer
    {
        protected var _bg:ScaleBitmap;
        protected var _desTxt:GTextFiled;
        protected var _danceBtn:GButton;
        protected var _line:ScaleBitmap;
        private var _info:Object;

        public function SunbathDanceCell()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.bg(0, 0, 274, 57, this, ImagesConst.PanelBg);
            this._desTxt = UIFactory.gTextField("" + Language.getString(70963), 17, 7, 240, 40, this, GlobalStyle.textFormatPutong.setColor(16777215).setBold(true));
            this._desTxt.multiline = true;
            this._desTxt.wordWrap = true;
            this._danceBtn = UIFactory.gButton("" + Language.getString(70964), 182, 27, 65, 26, this);
            this._line = UIFactory.bg(-2, 59, 273, 2, this, ImagesConst.SplitLine);
            this._danceBtn.drawNow();
            this._danceBtn.configEventListener(MouseEvent.CLICK, this.onDanceHd);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._info = null;
            this._bg = null;
            this._desTxt = null;
            this._danceBtn = null;
            this._line = null;
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            this._info = param1;
            if (this._info == null)
            {
                return;
            }
            this._desTxt.htmlText = "" + HTMLUtil.addColor(this._info["nameA"], "#00ff00") + " " + Language.getString(70965);
            return;
        }// end function

        private function onDanceHd(event:MouseEvent) : void
        {
            if (this._info == null)
            {
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.SunbathCopyOperNew, {type:ESunbathOper._ESunbathOperDance, sentity:this._info["info"]}));
            Dispatcher.dispatchEvent(new DataEvent(EventName.SunbathCopyCloseDanceList));
            return;
        }// end function

    }
}
